package com.timeDeal.servlet;









import com.timeDeal.bean.XuqiufabuBean;
import com.timeDeal.service.UserService;
import com.timeDeal.service.XuqiuService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


/**
 * Created by Administrator on 2016/7/24.
 */

public class XuqiuGuanliServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String  currentpage = request.getParameter("currentpage") ;
        XuqiuService xuqiuService =new  XuqiuService();
        List<XuqiufabuBean>  result= new ArrayList<>() ;
        UserService us = new UserService() ;
        result = xuqiuService.getAllXuqiuByZhuangtai("待审核",Integer.valueOf(currentpage));
        String   max = xuqiuService.getCountByZhuangtai("待审核") ;
        List<String> name = new ArrayList<>() ;
        for (int j =0 ;j<result.size() ;j++) {
            name.add(us.getDetailById(result.get(j).getJiafangid()));
        }
        request.setAttribute("result", result);
        request.setAttribute("max", max);
        request.setAttribute("currentpage",currentpage);
        request.setAttribute("name", name);
        response.getWriter().println("Url error!");
        request.getRequestDispatcher("/admin/xuqiuchuli.jsp").forward(request,response);





    }
}
